using UnityEngine;
using System.Collections;

public class SceneChange : MonoBehaviour
{
    // Varios controles pueden llevar este script
    // De momento compobamos el GUIText
    // Pero habra que hacer mas comprobaciones a medida que se apmlie

    public string newScene;
    private Color originalColor = Color.white;
    private Color otherColor = Color.yellow;
    private GUIText guiText = null;

    void Start()
    {
        this.guiText = this.gameObject.guiText;
    }

    void OnMouseUp()
    {
        if (this.guiText != null)
            this.gameObject.guiText.font.material.color = originalColor;

        Application.LoadLevel(newScene);
    }

    void OnMouseEnter()
    {
        if (this.guiText != null)
            this.gameObject.guiText.font.material.color = otherColor;
    }

    void OnMouseExit()
    {
        if (this.guiText != null)
            this.gameObject.guiText.font.material.color = originalColor;
    }
}
